/**
 * Board.h
 * Cocoa Tetris
 *
 * Copyright 2009 Wei Yeh, Evelyn Yung. All rights reserved.
 */

#import <Cocoa/Cocoa.h>
#import "Cell.h"

#define BOARD_WIDTH 10
#define BOARD_LENGTH 20

@class Cell;

@interface Board : NSView {
	NSMutableArray *cells;
}

-(Cell *)cellAtY:(unsigned int)y x:(unsigned int)x;

-(void)clearAll;

-(bool)isInBoundsY:(unsigned int)y x:(unsigned int)x;
/** Is it possible to mark the cell at the given coordinates? */
-(bool)canMarkCellAtY:(unsigned int)y x:(unsigned int)x;

-(void)drawRect:(NSRect)boardArea;

/** Shifts rows down starting from the row at the given index. */
-(void)shiftDownFromRow:(unsigned int)row;
/** Shifts down each unit on the row at the given row index. */
-(void)shiftDownUnitFromRow:(unsigned int)row;

/** Clears as many rows as possible. */
-(unsigned int)clear;
-(void)clearRow:(unsigned int)row;
/** Row is clearable if and only if every cell in that row is occupied. */
-(bool)isRowClearable:(unsigned int)row;
-(bool)isRowEmpty:(unsigned int)row;

-(BOOL)isOpaque;
-(BOOL)acceptsFirstResponder;
-(void)keyDown:(NSEvent *)event;

@end
